FastAPI and FastMCP gateway backed by a local Pi AgentSession
Project description
PROJECT Agentify
this project is to use pi agent as the fastapi and fastmcp server backend. you have a python server running on port 8000 (default).
in this port, you have a fastapi server and a mcp server.
Architecture
- python server, fastapi and mcp at port 8000
- embedded Pi Agent runtime provided by an npm package, vendored under
src/vendor/pi - internal Pi AgentSession bridge runs locally and accepts POST JSON messages, returning JSON messages
- the Python server should start/use this embedded local Pi AgentSession bridge by default, instead of requiring the user to set
AGENTIFY_PI_URLfor normal local runs AGENTIFY_PI_URLmay remain as an override for advanced/external Pi AgentSession endpoints
CLI
- a uv pip package with cli:
- agentify login: pi agent login routine, as the customer to choose pi agent backend
- agentify server [--port 8000] [-api_key abc123,abc1234] [-api_key_file path-to-key-list-file] start the server
HTTP behavior
- when a request (GET or POST) to the fastapi server with any , you will make make a prompt with json prompt json format with POST: { "endpoint": , "instruction": , "body": string(post body content), "format": "json" } send this json format to the pi agentsession server with POST, the return should be json as well. you rely the json return from the pi agentsession to the user. only check the json format, no need to check the content. if failed, ask the pi agent to do it again with the failure informaiton.
prompt json format with GET: { "endpoint": , "instruction": "this is a user GET query, you make a html file for this request with your understand from the endpoint string", "format": "html" } send this jso fomrat to the pi agent session server with POST, the return should be a json file contains html content. like { "content": "string of html file" } you decode the html content from this json file and return to the user, if there is a failure, re send the message to the pi agent again.
- all error endpoing, will follow the same style as above
MCP behavior
- all MCP tool calls error with generate a json format as: { "tool function": "user called tools", "instruciton": "decode from the tool payload if there, default null", "body": "string(the tool call)", "format": "json" }
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentify_cloud-0.1.1.tar.gz.
File metadata
- Download URL: agentify_cloud-0.1.1.tar.gz
- Upload date:
- Size: 32.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f760259caf5d9b6732062631a53593b9096f5b5ce971cc9b394590c386e74d9
|
|
| MD5 |
e2f72047d3cbf5b7eda011966a03df17
|
|
| BLAKE2b-256 |
6fe27be1d9c13987219b95a6976d3ea018d33ae762ef48b5a48f179c8f939e52
|
File details
Details for the file agentify_cloud-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentify_cloud-0.1.1-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e612b84a897fa6907ece56874bd9cca81707078d262a97722709c2ff476fea1b
|
|
| MD5 |
bbfbc5ba7a22d07f54e518461899ea77
|
|
| BLAKE2b-256 |
ffd9d8445c5c670daad2344ddd87d02fd065471bf22407d8536f8027c3b0d650
|