Skip to content

Latest commit

 

History

History

crewai-ghostwriters

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Ghostwriters Example (CrewAI)

Quick CrewAI agentic writer and editor system that drafts stories based on a topic.

Purpose:

  • Showcases how to use Orra with Crewai
  • Showcases how to use Orra with Python

Prerequisites:

Setup

  1. First, setup Orra and the CLI by following the installation instructions:

  2. Setup your Orra project:

# Create project, add a webhook and API key
orra projects add my-python-project
orra webhooks add http://host.docker.internal:8888/webhook 
orra api-keys gen ghost-key
  1. Configure the Ghost Writer agents:
cd examples/crewai-ghost-writers
cp _env .env

Edit the file and update the Environment variables accordingly. Use the generated ghost-key Orra API Key as the value for ORRA_API_KEY.

Running the Example

  1. Ensure the control plane is running, then start the webhook server (in a separate terminal):
# Start the webhook server using the verify subcommand
orra verify webhooks start http://localhost:8888/webhook

Switch back to the main shell tab to run your agents.

  1. Start and register the Ghostwriters' agents:
# With Poetry
poetry install
poetry run python src/main.py
  1. Trigger the blog posting generation:
# Send a test message
orra verify run 'Draft a blog post' \
--data topics_file_path:'/path/to/crewai-ghostwriters/writer-topic/fisherman-story.txt' \
--data output_path:'/path/to/crewai-ghostwriters/drafts/draft.txt' \
-t '5m' \
-w http://host.docker.internal:8888/webhook
  1. Check the result:
orra ps
orra inspect -d <orchestration-id>

Notes

This example uses an increased orchestration timeout of 5 minutes (default is 30s).

In this context the timeout was configured using the CLI's verify command using the --timeout flag (-t for short).

Watch out for CrewAI shenanigans

Sometimes the writer Crew get stuck writing and re-writing infinitely. This is a known ReACT prompt issue, where the prompt repetitively invokes the same function over and over.

Here, Orra is very patient because timeout has been increased to 5m. But it does kill the orchestration after a while. However, feel free to kill the Agent running process and start it again WITHOUT stopping the control plane.

Generally, you can keep the control plane running, while you work and update the CrewAI Agent code. Then simply,

  • ctrl+c to stop the running agents
  • Then, run the agents again using poetry run python src/main.py.

Orra with CrewAI

That's it! Orra provides:

  • Service discovery
  • Health monitoring
  • Reliable task execution
  • Error recovery

Learn More