A framework to create agents, tasks, and workflows.
Project description
Agent Framework
This repository provides a flexible system for building and orchestrating agents and workflows. It offers two modes:
- Client Mode: Where tasks call out to a remote API client (e.g., your
client.pyfunctions). - Local Mode: Where tasks run directly in the local environment, utilizing
run_agents(...)and local logic.
It also supports loading YAML or JSON workflows to define multi-step tasks.
Table of Contents
Overview
The framework has distilled Agents into 3 distinct pieces:
- Agents
- Tasks
- Workflows
The Agent can be configured with:
- Model Provider (e.g., OpenAI, Llama, etc.)
- Tools (e.g., specialized functions)
Users can define tasks (like council, sentiment, translate_text, etc.) in a local or client mode. They can also upload workflows (in YAML or JSON) to orchestrate multiple steps in sequence.
Installation
-
Clone the Repo:
git clone https://github.com/webcoderz/agents-framework.git cd agents-framework
-
Install Dependencies:
uv pip install -r requirements.txt
-
Set Environment Variables:
OPENAI_API_KEYfor the default OpenAI-basedChatOpenAI.LOGGING_LEVEL(optional) to configure logging verbosity:DEBUG,INFO, etc.
Concepts
Agents
- They can have a custom model provider (e.g.,
ChatOpenAI, a Llama-based model, etc.). - Agents can have tools attached, which are specialized functions accessible during execution.
- Agents can have a custom Persona Profile configured.
Tasks
- A task is a single step in a workflow, e.g.,
council,schedule_reminder,sentiment,translate_text, etc. - Tasks are managed by the
Tasksclass intasks.py. - Tasks can be chained for multi-step logic (e.g.,
tasks(text="...").council().sentiment().run_tasks()).
Client Mode vs Local Mode
- Local Mode: The system calls
run_agents(...)directly in your local environment. - Client Mode: The system calls out to remote endpoints in a separate API.
- In
client_mode=True, each task (e.g.sentiment) triggers a client function (sentiment_analysis(...)) instead of local logic.
- In
This allows you to switch between running tasks locally or delegating them to a server.
Workflows (YAML/JSON)
- You can define multi-step workflows in YAML or JSON.
- The endpoint
/upload-workflowaccepts a file (via multipart form data).- First tries parsing JSON.
- If that fails, it tries YAML.
- The file is validated against a
WorkflowDefinitionPydantic model. - Each step has a
type(e.g.,"sentiment","custom") and optional parameters (likeagents,target_language, etc.).
Usage
Creating Agents
from iointel.src.agents import Agent
my_agent = Agent(
name="MyAgent",
instructions="You are a helpful agent.",
model_provider="default" # or use a callable for custom model
)
Creating an Agent with a Persona
from iointel.src.agent_methods.data_models.datamodels import PersonaConfig
from iointel.src.agents import Agent
my_persona = PersonaConfig(
name="Elandria the Arcane Scholar",
age=164,
role="an ancient elven mage",
style="formal and slightly archaic",
domain_knowledge=["arcane magic", "elven history", "ancient runes"],
quirks="often references centuries-old events casually",
bio="Once studied at the Grand Academy of Runic Arts",
lore="Elves in this world can live up to 300 years",
personality="calm, wise, but sometimes condescending",
conversation_style="uses 'thee' and 'thou' occasionally",
description="Tall, silver-haired, wearing intricate robes with arcane symbols"
emotional_stability: 0.85,
friendliness: 0.45,
creativity: 0.68,
curiosity: 0.95,
formality: 0.1,
empathy: 0.57,
humor: 0.99,
)
agent = Agent(
name="ArcaneScholarAgent",
instructions="You are an assistant specialized in arcane knowledge.",
persona=my_persona
)
print(agent.instructions)
Building Tasks
In Python code, you can create tasks by instantiating the Tasks class and chaining methods:
from iointel.src.tasks import Tasks
tasks = Tasks(text="This is the text to analyze", client_mode=False)
(
tasks
.sentiment(agents=[my_agent])
.council() # a second step
)
results = tasks.run_tasks()
print(results)
Because client_mode=False, everything runs locally.
Running a Local Workflow
tasks = Tasks(text="Breaking news: local sports team wins!", client_mode=False)
tasks.summarize_text(max_words=50).run_tasks()
Running a Remote Workflow (Client Mode)
tasks = Tasks(text="Breaking news: local sports team wins!", client_mode=True)
tasks.summarize_text(max_words=50).run_tasks()
Now, summarize_text calls the client function (e.g., summarize_task(...)) instead of local logic.
Uploading YAML/JSON Workflows
1. Create a YAML or JSON file specifying tasks:
name: "My YAML Workflow"
text: "Large text to analyze"
workflow:
- type: "sentiment"
- type: "summarize_text"
max_words: 20
- type: "moderation"
threshold: 0.7
- type: "custom"
name: "special-step"
objective: "Analyze the text"
instructions: "Use advanced analysis"
context:
extra_info: "some metadata"
2. Upload via the /upload-workflow endpoint (multipart file upload).
The server reads it as JSON or YAML and runs the tasks sequentially in local mode.
Examples
Simple Summarize Task
tasks = Tasks("Breaking news: new Python release!", client_mode=False)
tasks.summarize_text(max_words=30).run_tasks()
Returns a summarized result.
Chainable Workflows
tasks = Tasks("Tech giant acquires startup for $2B", client_mode=False)
(tasks
.council()
.translate_text(target_language="es")
.sentiment()
)
results = tasks.run_tasks()
1. Council step,
2. Translate to Spanish,
3. Sentiment analysis.
Custom Workflow
tasks = Tasks("Analyze this special text", client_mode=False)
tasks.custom(
name="my-unique-step",
objective="Perform advanced analysis",
instructions="Focus on entity extraction and sentiment",
agents=[my_agent],
**{"extra_context": "some_val"}
)
results = tasks.run_tasks()
A "custom" task can reference a custom function in the CUSTOM_WORKFLOW_REGISTRY or fall back to a default behavior.
Loading From a YAML File
curl -X POST "http://<your server>/upload-workflow" \
-F "yaml_file=@path/to/workflow.yaml"
API Endpoints
Here are some of the key endpoints if you integrate via REST:
- POST /council: Runs a council vote with ScheduleRequest.task.
- POST /reasoning: Runs a reasoning step with TextRequest.
- POST /summarize: Summarizes text in TextRequest.
- POST /sentiment: Performs sentiment analysis on TextRequest.
- POST /extract-entities: Extracts categorized entities.
- POST /translate: Translates text.
- POST /classify: Classifies text.
- POST /moderation: Moderation checks with a threshold.
- POST /custom-workflow: Runs a single “custom” step from CustomWorkflowRequest.
- POST /upload-workflow: Accepts JSON or YAML for multi-step workflows.
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 iointel-1.0.0.tar.gz.
File metadata
- Download URL: iointel-1.0.0.tar.gz
- Upload date:
- Size: 170.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.28
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e31c874b80c14f8f7bd9e0a9b72214731d5647d2e2b65ba6cb3e1100a8c788a
|
|
| MD5 |
ad2e80e7452026b311b15d983aa17f61
|
|
| BLAKE2b-256 |
c5e5a2053269481ae9b129da9f6e62316ba812befb7db2f3588c1ac8b2a37a3e
|
File details
Details for the file iointel-1.0.0-py3-none-any.whl.
File metadata
- Download URL: iointel-1.0.0-py3-none-any.whl
- Upload date:
- Size: 36.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.28
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5551acac51feed3f3d9b5e1c078a162f565a6e8211acb8e168412b19ed8629b2
|
|
| MD5 |
1caf28dadf63e0e07d7bed6c3fe184d4
|
|
| BLAKE2b-256 |
4330a60c20875dc977bc5020729d6ae987f39c1e22949763ea9d25c6772e26ec
|